﻿using System;
using System.Collections.Generic;

namespace Migrations.Core
{
	public class VersionComparer
	{
		private readonly AppVersion _appVersion;
		private readonly IList<MigrationScript> _migrationScripts;

		public VersionComparer(AppVersion appVersion)
		{
			_appVersion = appVersion;
			_migrationScripts = new List<MigrationScript>();
		}

		public IList<MigrationScript> MigrationScripts
		{
			get { return _migrationScripts; }
		}

		public void CompareWith(DbVersion dbVersion)
		{
			if (dbVersion.IsDifferentFrom(_appVersion))
			{
				_migrationScripts.Add(new MigrationScript());
				_migrationScripts.Add(new MigrationScript());
				_migrationScripts.Add(new MigrationScript());
			}
		}

		public bool ChangesPending()
		{
			return _migrationScripts.Count > 0;
		}
	}
}
